export const pannelSetMap = (mapSet, mapSolveSet, areaSet = false) => {
  const pos = { leftPlus: 45, leftCur: 180, left: 20, top: 5 }
  const style = { font: '16px "Microsoft YaHei", sans-serif', textColor: '#333', lineColor: 'rgba(147, 235, 248, .8)'}
  const titleSet = {
    title: {
      textStyle:{
        fontWeight: 'normal',
        fontSize: 18
      },
      left: 15,
      top: 10,
      text: '全国'
    }
  }
  const graphicSet = {
    graphic: [
      {
        id: '20181129',
        type: 'group',
        z: 10,
        zindex: 10,
        left: pos.left,
        top: pos.top + 8,
        children: [{
          type: 'text',
          left: 0,
          top: 'middle',
          style: {
            text: '全国',
            textAlign: 'center',
            fill: style.textColor,
            font: style.font
          },
          onclick: () => {
            /*myChart.clear()
            myChart.setOption(this.getCategorySalesTrend)
            clickSet = true*/
          }
        }]
      },
      {
        id: '20181130',
        type: 'group',
        z: 10,
        zindex: 10,
        left: pos.left + pos.leftPlus,
        top: pos.top + 8,
        children: [
          {
            type: 'polyline',
            left: -95,
            top: 35,
            shape: {
              points: [[0, 0], [6, 6],[0, 12]]
            },
            style: {
              stroke: style.textColor,
              key: '2020',
              lineWidth: 1
            }
          },
          {
            type: 'text',
            left: -72,
            top: 35,
            style: {
              text: areaSet,
              textAlign: 'center',
              fill: style.textColor,
              font: style.font
            }
          }]
      }
    ]
  }

  let optionSet = {
    tooltip: {
      trigger: 'item',
      formatter: function(params) {
        if (params.data && params.data.value){
          return `地区: ${params.name}</br>终端数: ${params.data.shopNum}</br>销售量: ${params.data.salesCount}</br>销售额: ${params.data.salesAmount}`
        }
      }
    },
    grid: {
      top: '20%',
      bottom: 90,
      left: '15%'
    },
    visualMap: {
      min: 0,
      max: 2500,
      left: 'left',
      top: 'bottom',
      text: ['高','低'],
      calculable: true
    },
    series: [
      {
        name: '用户分布',
        type: 'map',
        mapType: mapSet.name,
        roam: true,
        zoom: 1.2,
        scaleLimit:{
          min: 1,
          max: 3
        },
        label: {
          normal: {
            show: true
          },
          emphasis: {
            show: true
          }
        },
        data: mapSolveSet
      }
    ]
  }
  optionSet = areaSet ? Object.assign({},optionSet,graphicSet) : Object.assign({},optionSet,titleSet)
  return optionSet
}
